import threading
import time
from threading import Thread


class SubThread(Thread):
    def __init__(self):
        for i in range(3):
            time.sleep(1)
            print(f'线程{threading.current_thread().name}正在执行, i -> {i}')


if __name__ == '__main__':
    print('主线程开始执行')
    start = time.time()
    lst = [SubThread() for i in range(2)]
    for item in lst:
        item.start()
    for item in lst:
        item.join()
    print('共消耗的时间:', time.time() - start)
    print('主线程结束执行')